package leetcode.part1;

import org.junit.Test;

import java.util.Arrays;

public class S11 {
    public int hIndex(int[] citations) {
        Arrays.sort(citations);
        int len=citations.length;
        int i=len-1;
        int h=0;
        while (i>=0&&citations[i]>h){
            h++;
            i--;
        }
        return h;
    }
    @Test
    public void test(){
        int[] array={3,0,6,1,5};
        System.out.println(hIndex(array));
    }
}
